package com.example.taobaolianmeng.utils;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.example.taobaolianmeng.base.BaseApplication;
import com.example.taobaolianmeng.model.domain.IBaseInfo;
import com.example.taobaolianmeng.presenter.ITicketPresenter;
import com.example.taobaolianmeng.ui.activity.TicketActivity;

public class TicketUtil {
    public static  void toTicketPage(Context context,IBaseInfo baseInfo){
        //特惠聊表内容被点击
        String title = baseInfo.getTitle();
        //详情地址
        String url = baseInfo.getUrl();
        if(TextUtils.isEmpty(url)){
            //如果没有优惠券直接跳转商品
            url =baseInfo.getUrl();
        }
        String cover = baseInfo.getCover();
        //拿到ticketPresenter去加载数据
        ITicketPresenter ticketPresenter = PresenterManger.getInstance().getTicketPresenter();
        ticketPresenter.getTicket(title,url,cover);
        context.startActivity(new Intent(context, TicketActivity.class));
    }
}
